<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>数组的sort方法</title>
	</head>
	<body>
		<script>
		//sort()默认是按照字母升序排列，也可以加函数设置按数字升序/降序
		var f=['banana','apple','mango'];
		f.sort();
		console.log(f);
		
		
		
		
		var n=[3,51,21,60,7];
		n.sort(
			function(a,b){
				return a-b;
			}
		);
		console.log(n);
		</script>
	</body>
</html>
